/*
 * Copyright 2016 Martin Winandy
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */

package org.ricks.log;

import java.util.Map;

/**
 * Immutable holder of all required data for writing a log entry.
 *
 * <p>
 * A writer can only depend on values that have been requested. All other values are may {@code null}.
 * </p>
 */
public final class LogEntry {

	private final Timestamp timestamp;
	private final Thread thread;
	private final Map<String, String> context;
	private final String className;
	private final String methodName;
	private final String fileName;
	private final int lineNumber;
	private final boolean base;
	private final Level level;
	private final String message;
	private final Throwable exception;


	public LogEntry(final Timestamp timestamp, final Thread thread, final Map<String, String> context, final String className,
                    final String methodName, final String fileName, final int lineNumber, final boolean base, final Level level,
                    final String message, final Throwable exception) {
		this.timestamp = timestamp;
		this.thread = thread;
		this.context = context;
		this.className = className;
		this.methodName = methodName;
		this.fileName = fileName;
		this.lineNumber = lineNumber;
		this.base = base;
		this.level = level;
		this.message = message;
		this.exception = exception;
	}

	public Timestamp getTimestamp() {
		return timestamp;
	}

	public Thread getThread() {
		return thread;
	}

	public Map<String, String> getContext() {
		return context;
	}

	public String getClassName() {
		return className;
	}

	public String getMethodName() {
		return methodName;
	}

	public String getFileName() {
		return fileName;
	}

	public int getLineNumber() {
		return lineNumber;
	}

	public boolean isBase() {
		return base;
	}

	public Level getLevel() {
		return level;
	}

	public String getMessage() {
		return message;
	}

	public Throwable getException() {
		return exception;
	}

}
